import java.util.Scanner;

public class demo01 {
    //正则问题
    public static int len=-1;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        int len=dfs(str);
        System.out.println(len);
    }
    public static int dfs(String str){
        int count=0;
        int max=0;
        while (len<str.length()-1){
            len++;
            if(str.charAt(len)=='('){
                count+=dfs(str);
            }else if (str.charAt(len)=='x'){
                count++;
            }else if (str.charAt(len)=='|'){
                max=Math.max(count,max);
                count=0;
            }else {
                break;
            }
        }
        return Math.max(max,count);
    }
}
